<?php
require_once 'const/DBConst.php';
?>

<script language="javascript">
    function checkdata() {
        var form_reg = document.formmyhome;

        if(form_reg.username.value == '') {
            alert('您忘了填姓名！');
            form_reg.username.focus();
            return false;
        }

        if(form_reg.email.value == '') {
            alert('您忘了填email！');
            form_reg.email.focus();
            return false;
        }
        if(form_reg.email.value != '') {
            var patrn=/^(.+?)@([a-z0-9\.]+)\.([a-z]){2,5}$/i;
            if (!patrn.exec(form_reg.email.value)) {
                alert('填入的email不正确！');
                form_reg.email.focus();
                return false;
            }
        }

        if(form_reg.oldpassword.value == '') {
            alert('您忘了填密码，未安全起见，修改资料必须填入密码！');
            form_reg.oldpassword.focus();
            return false;
        }
        if(form_reg.password.value != '') {
            if(form_reg.password.value != form_reg.repassword.value) {
                alert('两次填入的密码不相等！');
                form_reg.password.focus();
                return false;
            }
        }

        if(form_reg.phone.value == '') {
            alert('您忘了填电话！');
            form_reg.phone.focus();
            return false;
        }
        if(form_reg.phone.value != '') {
            var patrn=/^([0-9\-\.\s\(\)]+){5,22}$/i;
            if (!patrn.exec(form_reg.phone.value)) {
                alert('填入的联系电话不正确！');
                form_reg.phone.focus();
                return false;
            }
        }

        if(form_reg.address.value == '') {
            alert('您忘了填邮寄地址！');
            form_reg.address.focus();
            return false;
        }

        if(form_reg.postcode.value == '') {
            alert('您忘了填邮寄地址邮编！');
            form_reg.postcode.focus();
            return false;
        }
        return true;
    }
</script>
<div class="cl"></div>
<div id="page">
    <div class="sys-phpshop" id="header">
        <div id="topnav">
            <ul class="guid" id="guid">
                <li  id="guid1"><a href="/profile/list"><span>订单管理</span></a></li>
                <li class="selected" id="guid2"><a href="/profile/info"><span>个人信息</span></a></li>

            </ul>
            <script language="javascript">
                function checmenu(id,v,classname){
                    for (i = 1; i < 10; i++) {
                        var n = id+i;
                        if(document.getElementById(n)) {
                            document.getElementById(n).className="";
                        }
                    }
                    document.getElementById(id+v).className=classname;
                }
            </script>
        </div>
    </div>
    <div id="content">
        <div class="grid-c2" id="phpshop-panel">
            <div class="col-main">
                <div class="main-wrap">
                    <div id="main-content">
                        <div class="item-list" id="divUserHomeR">
                            <form name="formmyhome" action="/profile/info" method="POST" onsubmit="return checkdata()">
                                <table width="52%" border="0">
<!--	{if success!=0}<tr><td width="34%"><font color="#FF0000">错误！修改不成功！请检查您输入的密码是否正确。</font></td><td width="66%"></td></tr>{/if}-->
                                    <tr>
                                        <td style="text-align:right;">我的姓名：</td>
                                        <td><input id="username" size="25" name="<?php echo P_NAME ?>" value="<?php echo $this->profile[C_NAME] ?>" /></td>
                                    </tr>
                                    <tr>
                                        <td style="text-align:right;">我的Email：</td>
                                        <td><input id="email" size="25" name="<?php echo P_EMAIL ?>" value="<?php echo $this->email ?>" /></td>
                                    </tr>
                                    <tr>
                                        <td></td>
                                        <td></td>
                                    </tr>
                                    <tr>
                                        <td style="text-align:right;">我的密码：</td>
                                        <td><input name="<?php echo P_OLD_PASSWORD ?>" type="password" id="oldpassword" size="25" /></td>
                                    </tr>
                                    <tr>
                                        <td style="text-align:right;">修改密码：</td>
                                        <td><input name="<?php echo P_PASSWORD ?>" type="password" id="password" size="25" /></td>
                                    </tr>
                                    <tr>
                                        <td style="text-align:right;">请再次输入修改密码：</td>
                                        <td><input name="repassword" type="password" id="repassword" size="25" /></td>
                                    </tr>
                                    <tr>
                                        <td></td>
                                        <td></td>
                                    </tr>
                                    <tr>
                                        <td style="text-align:right;">我的联系电话：</td>
                                        <td><input id="phone" size="25" name="<?php echo P_PHONE ?>" value="<?php echo $this->profile[C_PHONE] ?>" /></td>
                                    </tr>
                                    <tr>
                                        <td></td>
                                        <td></td>
                                    </tr>
                                    <tr>
                                        <td style="text-align:right;">我的邮寄地址：</td>
                                        <td><input id="address" size="25" name="<?php echo P_ADDRESS ?>" value="<?php echo $this->profile[C_ADDRESS] ?>" /></td>
                                    </tr>
                                    <tr>
                                        <td></td>
                                        <td></td>
                                    </tr>
                                    <tr>
                                        <td></td>
                                        <td></td>
                                    </tr>
                                    <tr>
                                        <td></td>
                                        <td><input name="modify" type="submit" value="修改" /> <input value="重填" type="reset" /></td>
                                    </tr>
                                    <tr>
                                        <td></td>
                                        <td></td>
                                    </tr>
                                </table>
                            </form>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>
</div>